"""
# -*- coding: utf-8 -*-
# @Time    : 2023/5/29 16:58
# @Author  : 王摇摆
# @FileName: Visual.py
# @Software: PyCharm
# @Blog    ：https://blog.csdn.net/weixin_44943389?type=blog
"""
import matplotlib.pyplot as plt

from Pocket.Simple.Data import buildLine, W, start, end, X, y

plt.rcParams['font.sans-serif'] = ['Microsoft YaHei']  # 选择一个本地的支持中文的字体

x1 = X[y > 0][:, 0]
y1 = X[y > 0][:, 1]
x2 = X[y < 0][:, 0]
y2 = X[y < 0][:, 1]
plt.title('口袋算法',fontproperties='KaiTi',fontsize=20)
p1 = plt.scatter(x1, y1, c='b', marker='o', s=20)
p2 = plt.scatter(x2, y2, c='r', marker='o', s=20)
x3, y3 = buildLine(W, start, end)
plt.plot(x3, y3)
plt.legend([p1, p2], ["正1", "负1"], loc="upper right",fontsize=18)
plt.show()
